package com.example.demo.bo;//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;

@ApiModel("基础查询条件")
public class BaseQueryParam   implements Serializable {
    private static final long serialVersionUID = -5283460708108514233L;
    @ApiModelProperty(
            value = "当前页码，从1开始，默认1",
            position = 999
    )
    protected long page = 1L;
    @ApiModelProperty(
            value = "每页显示记录数, 默认10",
            position = 1000
    )
    protected long limit = 10L;
    @ApiModelProperty(
            value = "排序字段 多字段用,（小写逗号）隔开 驼峰式",
            position = 999
    )
    private String orderField;
    @ApiModelProperty(
            value = "是否升序 默认降序",
            position = 998
    )
    private boolean asc;

    public BaseQueryParam(long page, long limit) {
        if (page > 1L) {
            this.page = page;
        }

        this.limit = limit;
    }

    public long getStartIndex() {
        return (this.page - 1L) * this.limit;
    }

    public long getEndIndex() {
        return this.getStartIndex() + this.limit;
    }

    public BaseQueryParam() {
    }

    public BaseQueryParam(long page, long limit, String orderField, boolean asc) {
        this.page = page;
        this.limit = limit;
        this.orderField = orderField;
        this.asc = asc;
    }

    public String toString() {
        return "BaseQueryParam(super=" + super.toString() + ", page=" + this.getPage() + ", limit=" + this.getLimit() + ", orderField=" + this.getOrderField() + ", asc=" + this.isAsc() + ")";
    }

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof BaseQueryParam)) {
            return false;
        } else {
            BaseQueryParam other = (BaseQueryParam)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (!super.equals(o)) {
                return false;
            } else if (this.getPage() != other.getPage()) {
                return false;
            } else if (this.getLimit() != other.getLimit()) {
                return false;
            } else if (this.isAsc() != other.isAsc()) {
                return false;
            } else {
                Object this$orderField = this.getOrderField();
                Object other$orderField = other.getOrderField();
                if (this$orderField == null) {
                    if (other$orderField != null) {
                        return false;
                    }
                } else if (!this$orderField.equals(other$orderField)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof BaseQueryParam;
    }



    public long getPage() {
        return this.page;
    }

    public long getLimit() {
        return this.limit;
    }

    public String getOrderField() {
        return this.orderField;
    }

    public boolean isAsc() {
        return this.asc;
    }

    public void setPage(long page) {
        this.page = page;
    }

    public void setLimit(long limit) {
        this.limit = limit;
    }

    public void setOrderField(String orderField) {
        this.orderField = orderField;
    }

    public void setAsc(boolean asc) {
        this.asc = asc;
    }
}
